﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using Stanza.Silverlight.Controls;

namespace Demo
{
    public partial class ModalPopupDemo : AutoSizeUserControl
    {
        public ModalPopupDemo()
        {
            InitializeComponent();

            showDefaultBtn.Click += new RoutedEventHandler( showDefaultBtn_Click );
            showRelativeBtn.Click += new RoutedEventHandler( showRelativeBtn_Click );
            closeBtn.Click += new RoutedEventHandler( closeBtn_Click );
            showFullScreen.Click += delegate( object sender, RoutedEventArgs e ) {
                Application.Current.Host.Content.IsFullScreen = !Application.Current.Host.Content.IsFullScreen;
            };
        }

        void showDefaultBtn_Click( object sender, RoutedEventArgs e )
        {
            popupPanel.OpenPopup( 70, 70 );
        }

        void showRelativeBtn_Click( object sender, RoutedEventArgs e )
        {
            Point pt = showRelativeBtn.GetAbsolutePosition();
            pt.X += showRelativeBtn.Width / 2;
            pt.Y += showRelativeBtn.Height / 2;
            popupPanel.OpenPopup( pt );
        }

        void closeBtn_Click( object sender, RoutedEventArgs e )
        {
            popupPanel.ClosePopup();
        }
    }
}
